OpenCompass
Initializes and sets the mode of the HiTechnic magnetic compass sensor
Contents
Syntax
OpenCompass(port)
OpenCompass(port, handle)
Description
OpenCompass(port) initializes the input mode of HiTechnic compass sensor specified by the sensor port. The value port can be addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick.
With GetCompass(port) you can receive the heading value ranging from 0 to 359.
The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).
Since the compass sensor is a digital sensor (that uses the I²C protocol), the function NXT_SetInputMode cannot be used as for analog sensors.
Examples
OpenCompass(SENSOR_2); degree = GetCompass(SENSOR_2); CloseSensor(SENSOR_2);
See also
GetCompass, CloseSensor, COM_ReadI2C, NXT_LSGetStatus, NXT_LSRead
Signature
- Author: Rainer Schnitzler (see AUTHORS)
- Date: 2008/08/01
- Copyright: 2007-2008, RWTH Aachen University